﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>使用userData保存select标记</title>
    <style>
        .userData {
            behavior: url(#default#userdata);
        }
    </style>
</head>
<body>
    <select id="select1" class="userData">
        <option>ѡitһ</option>
        <option>ѡion</option>
        <option>ѡitch</option>
        <option>ѡatch</option>
    </select>
    <script>
        var obj = document.all.select1;
        obj.attachEvent('onchange', saveSelectedIndex)
        function saveSelectedIndex() {
            obj.setAttribute("sSelectValue", obj.selectedIndex);
            obj.save("oSltIndex");
        }
        window.attachEvent('onload', loadSelectedIndex)
        function loadSelectedIndex() {
            obj.load("oSltIndex");
            obj.selectedIndex = obj.getAttribute("sSelectValue");
        }

    </script>
</body>
</html>